package com.study.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class GoodByeServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
    private String msg = "hello world.";

    public GoodByeServlet() {
    }

    public GoodByeServlet(String msg) {
        this.msg = msg;
    }

    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html");
        resp.setStatus(HttpServletResponse.SC_OK);
        resp.getWriter().println("<h1>" + msg + "</h1>");
        resp.getWriter().println("session=" + req.getSession().getId());

    }

    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }
}
